package com.pet.behavior.controller;


import com.pet.behavior.service.ApLikesBehaviorService;
import com.pet.common.controller.AbstractController;
import com.pet.model.behavior.dtos.LikesBehaviorDto;
import com.pet.model.behavior.pojos.ApLikesBehavior;
import com.pet.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
* <p>
* APP点赞行为表 控制器</p>
*/
@RestController
@RequestMapping("/api/likesBehavior")
public class ApLikesBehaviorController extends AbstractController<ApLikesBehavior>{

    private ApLikesBehaviorService apLikesBehaviorService;

    //注入
    @Autowired
    public ApLikesBehaviorController(ApLikesBehaviorService apLikesBehaviorService) {
        super(apLikesBehaviorService);
        this.apLikesBehaviorService=apLikesBehaviorService;
    }

    /**
     * 点赞/取消点赞行为
     */
    @PostMapping
    public ResponseResult likes(@RequestBody LikesBehaviorDto dto){
        return apLikesBehaviorService.likes(dto);
    }

    /**
     * 查询点赞行为记录
     */
    @GetMapping("getLikeBehavior")
    public ResponseResult<ApLikesBehavior> getLikeBehavior(@RequestParam("entryId")Integer entryId,@RequestParam("articleId")Long articleId){
        return apLikesBehaviorService.getLikeBehavior(entryId,articleId);
    }
}

